package com.ffcc.fitness.coach.controller;

import com.ffcc.fitness.base.response.JsonResult;
import com.ffcc.fitness.coach.pojo.dto.CoachUpdateParam;
import com.ffcc.fitness.coach.pojo.entity.Coach;
import com.ffcc.fitness.coach.pojo.vo.CoachVO;
import com.ffcc.fitness.coach.service.CoachService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("v1/coach/")
@Slf4j
public class CoachController {
    @Autowired
    private CoachService coachService;

    @PostMapping("update")
    public JsonResult update(CoachUpdateParam coachUpdateParam){
        Coach coach = coachService.update(coachUpdateParam);
        return JsonResult.ok(coach);
    }

    //根据userId查coachId
    @GetMapping("selectByUserId")
    public JsonResult selectByUserId(@RequestParam Long userId){
        CoachVO coachVO = coachService.selectCoachByUserId(userId);
        return JsonResult.ok(coachVO);
    }



}
